﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PanGu;

namespace PatientInformationExtract.MainInterface.Models.XMLCS
{
    public class ProcessNoteUnit
    {
        private string _time;
        public string Time { get { return this._time; } }
        private string _type;
        public string Type { get { return this._type; } }
        private string _doctor;
        public string Doctor { get { return this._doctor; } }
        private ICollection<WordInfo> _words;
        public ICollection<WordInfo> Words { get { return this._words; } }
        public string NoteText
        {
            get
            {
                string buffer = null;
                if (_words != null)
                {
                    foreach (WordInfo word in _words)
                    {
                        buffer += word.Word;
                    }
                }
                return buffer;
            }
        }
        
        private Segment _segment;

        public ProcessNoteUnit()
        {
            _time = null;
            _type = null;
            _doctor = null;
            _words = null;
            _segment = null;
        }

        public ProcessNoteUnit(Segment segment)
        {
            _time = null;
            _type = null;
            _doctor = null;
            _words = null;
            _segment = segment;
        }

        public void setTime(string time)
        {
            this._time = time;
        }

        public void setType(string type)
        {
            this._type = type;
        }

        public void setDoctor(string doctor)
        {
            this._doctor = doctor;
        }

        public void setWords(string context)
        {
            if (_segment == null)
            {
                _segment = new Segment();
            }
            _words = _segment.DoSegment(context,true);
        }

        public void setWords(ICollection<WordInfo> words)
        {
            _words = words;
        }
    }
}
